package com.meituan.provider;

import com.meituan.model.EvaluateEntity;
import org.apache.ibatis.jdbc.SQL;

import java.text.SimpleDateFormat;
import java.util.Date;

public class EvaluateProvider {
    public String insertEvaluate(EvaluateEntity evaluateEntity){
        SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss" );
        String current = sdf.format(new Date());
        return new SQL(){
            {
                INSERT_INTO("evaluate");
                VALUES("order_id","#{orderId}");
                VALUES("user_id","#{userId}");
                VALUES("shop_id","#{shopId}");
                VALUES("evaluation_score","#{evaluationScore}");
                VALUES("publish_time","'"+current+"'");
                VALUES("evaluation_content","#{evaluationContent}");
            }
        }.toString();
    }
}
